﻿namespace NGen.Systems.FSM
{
	public class FsmState<TStateType, TInterfaceType>
		where TStateType : FsmState<TStateType, TInterfaceType>
		where TInterfaceType : Fsm<TStateType, TInterfaceType>
	{
		/// <summary>
		/// 	internal reference to the state machine
		/// </summary>
		internal Fsm<TStateType, TInterfaceType> m_stateMachine;

		/// <summary>
		/// 	get a reference to the state machine managing this state. 
		/// 	this is set automatically when state is pushed.
		/// </summary>
		public TInterfaceType StateMachine {
			get { return (TInterfaceType) m_stateMachine; }
		}

		/// <summary>
		/// 	called whenever a state becomes the top state on the stack, via a push OR pop
		/// </summary>
		public virtual void OnEnter() {}

		/// <summary>
		/// 	called whenever a state is no longer the top state on the stack
		/// </summary>
		public virtual void OnExit() {}
	}
}